<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>新增页面</title>
		<link rel="stylesheet" href="../../../component/pear/css/pear.css" />
	</head>
	<body>
		<form class="layui-form" action="">
			<div class="mainBox">
				<div class="main-container">

					<div class="layui-form-item layui-form-text">
						<label class="layui-form-label">题目</label>
						<div class="layui-input-block">
							<textarea name="title" placeholder="请输入内容" class="layui-textarea"></textarea>
						</div>
					</div>
					<div class="layui-form-item layui-inline">
						<label class="layui-form-label">类别</label>
						<div class="layui-input-inline">
							<select name="stype" lay-verify="required" lay-search>
								<option value="0"></option>
								<option value="1">类别1</option>
								<option value="2">类别2</option>
								<option value="3">类别3</option>
								<option value="4">类别4</option>
								<option value="5">类别5</option>
								<option value="6">类别6</option>
								<option value="7">类别7</option>
								<option value="8">类别8</option>
							</select>
						</div>
					</div>
					<div class="layui-form-item layui-form-text">
						<label class="layui-form-label">选项1</label>
						<div class="layui-input-block">
							<textarea name="option1" placeholder="请输入内容" class="layui-textarea"></textarea>
						</div>
					</div>
					<div class="layui-form-item layui-inline">
						<label class="layui-form-label">分值1</label>
						<div class="layui-input-inline">
							<input type="number" name="opvalue1" placeholder="" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item layui-form-text">
						<label class="layui-form-label">选项2</label>
						<div class="layui-input-block">
							<textarea name="option2" placeholder="请输入内容" class="layui-textarea"></textarea>
						</div>
					</div>
					<div class="layui-form-item layui-inline">
						<label class="layui-form-label">分值2</label>
						<div class="layui-input-inline">
							<input type="number" name="opvalue2" placeholder="" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item layui-form-text">
						<label class="layui-form-label">选项3</label>
						<div class="layui-input-block">
							<textarea name="option3" placeholder="请输入内容" class="layui-textarea"></textarea>
						</div>
					</div>
					<div class="layui-form-item layui-inline">
						<label class="layui-form-label">分值3</label>
						<div class="layui-input-inline">
							<input type="number" name="opvalue3" placeholder="" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item layui-form-text">
						<label class="layui-form-label">选项4</label>
						<div class="layui-input-block">
							<textarea name="option4" placeholder="请输入内容" class="layui-textarea"></textarea>
						</div>
					</div>
					<div class="layui-form-item layui-inline">
						<label class="layui-form-label">分值4</label>
						<div class="layui-input-inline">
							<input type="number" name="opvalue4" placeholder="" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item layui-form-text">
						<label class="layui-form-label">题目解析</label>
						<div class="layui-input-block">
							<textarea name="explaination" placeholder="请输入内容" class="layui-textarea"></textarea>
						</div>
					</div>


				</div>
			</div>
			<div class="bottom">
				<div class="button-container">
					<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
						lay-filter="user-save">
						<i class="layui-icon layui-icon-ok"></i>
						提交
					</button>
					<button type="reset" class="pear-btn pear-btn-sm">
						<i class="layui-icon layui-icon-refresh"></i>
						重置
					</button>
				</div>
			</div>
		</form>
		<script src="../../../component/layui/layui.js"></script>
		<script src="../../../component/pear/pear.js"></script>
		<script>
			layui.use(['form', 'jquery','upload'], function() {
				let form = layui.form;
				let $ = layui.jquery;
				var upload = layui.upload;
				$.ajaxSetup({
					headers:{
						'Authorization':window.sessionStorage.getItem("token")
					}
				})
				form.on('submit(user-save)', function(data) {
					$.ajax({
						url: window.BASEPATH+'surveyques/add',
						data: data.field,
						type: 'post',
						success: function(result) {
							if (result.code==0) {
								layer.msg(result.msg, {
									icon: 1,
									time: 1000
								}, function() {
									parent.layer.close(parent.layer.getFrameIndex(window
										.name)); //关闭当前页
									parent.layui.table.reload("user-table");
								});
							} else {
								layer.msg(result.msg, {
									icon: 2,
									time: 1000
								});
							}
						}
					})
					return false;
				});
			})
		</script>
		<script>
		</script>
	</body>
</html>
